<extend name="Public:common" />
<block name="body">
    <notempty name="list">
        <div class="pure-u-11-13">
            <div class="index-content-top">     
                <div class="conten-issue">
                    <div class="form-box">
                        <form action="__SELF__" method="post">
                            <input type="text" name="username" />
                            <input type="submit" value="搜索"/>
                        </form>
                    </div>
                </div>
            </div>
            <div class="zao"></div>
            <table border="1" cellspacing="" cellpadding="" class="index-content-table index-table-head" width="100%">
                <tr>
                    <td width="80px">微博id</td>
                    <td width="100px">模特用户名</td>
                    <td class="weibo-img">朋友圈封面图</td>
                    <td width="500px">朋友圈内容</td>
                    <td width="150px">添加时间</td>
                    <if condition="$is_seller eq 0"><!--管理员-->
                      <th width="100px">审核状态</th>
                      <th width="100px">操作</th>
                    </if>
                </tr>
                <volist name="list" id="vo">
                    <tr> 
                        <td>{$vo.wid}</td>
                        <td>{$vo.username}</td>
                        <td class="weibo-img"> 
                            <img src="__WWWROOT__{$vo['pics'][0]['pic_url']}" width="100" />                               
                        	<div class="img-box">
                        		<volist name='vo.pics' id='pic'>
                                	<img src="__WWWROOT__{$pic.pic_url}"  />
                            	</volist>    
                        	</div>                                           
                        </td>
                        <td style="text-align:left;padding-left:10px;line-height:26px">{$vo.content}</td>
                        <td>{$vo.add_time}</td>
                        <if condition="$is_seller eq 0"><!--管理员-->
                            <td width="110px">
                                <if condition='$vo.status eq 0'>
                                    <span name='{$vo.wid}' class="wcheck" style="display: block">显示微博</a></span>
                                    <else /> <span name='{$vo.wid}' class='wchecked' style="display: block">隐藏微博</span>
                                </if>
                          	</td>
                          	<td>
                                <a href="{:U('Admin/Weibo/delWeibo',array('wid'=>$vo[\"wid\"]))}" class="index-amend ">删除微博</a> 
                            </td>
                         </if>
                    </tr>
                </volist>             
            </table>
            <div class="index-paging">
             {$show_page}
            </div>
        </div>
    </notempty>
    <empty name="list">
        <div class="pure-u-11-13">
            <div class="index-content-top">     
                <div class="conten-issue">
                    <h2>暂无微博</h2>
                </div>
            </div>
        </div>
    </empty>
</block>
<block name='script'>
    <script type="text/javascript">
        //审核显示微博
        $('.wcheck').live('click',function(){
            var weibo = $(this);
            $.post(
                "{:U('Admin/Weibo/checkWeibo')}",
                {
                    wid:weibo.attr('name'),
                    status:1
                },
                function(data){
                    if(data.code == 1){
                        weibo.text('隐藏微博');
                        weibo.attr('class', 'wchecked');
                    }
                }
            );
        });
        //隐藏微博
        $('.wchecked').live('click',function(){
            var weibo = $(this);
            $.post(
                "{:U('Admin/Weibo/checkWeibo')}",
                {
                    wid:weibo.attr('name'),
                    status:0
                },
                function(data){
                    if(data.code == 1){
                        weibo.text('显示微博');
                        weibo.attr('class', 'wcheck');
                    }
                }
            );
        });
        //查看微博图片
        $(function(){
        	var hi = $(window).innerHeight();
        	$(".zao").height(hi);
        	$(".weibo-img").click(function(){
        	$(this).find(".img-box").show();
        	$(".zao").show();
     
        	});
        	$(".zao").click(function(){
        		$(".weibo-img .img-box").hide();        		
        		$(this).hide();        		
        	});
        });
    </script>
</block>
